<!doctype html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="copyright" content="Copyright (c) CMS">
    <title>扫一扫</title>
    <meta name="viewport" content="width=device-width, height=device-height,initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta content="telephone=no" name="format-detection">
    <meta name="Description" content="">

    <link rel="stylesheet" href="monkey.min.css">
    <script type="text/javascript" src="js/zs.js"></script>
    <script type="text/javascript" src="js/bridge.js"></script>
<script type="text/javascript">
    Request = {
        QueryString : function(item){
            var svalue = location.search.match(new RegExp("[\?\&]" + item + "=([^\&]*)(\&?)","i"));
            return decodeURIComponent(svalue ? svalue[1] : svalue);
        }
    }
    function getItemFromUrl(url,item){
        if(url==undefined || url==null) return "";
        var svalue =url.match(new RegExp("[\?\&]" + item + "=([^\&]*)(\&?)","i"));
        return decodeURI(svalue ? svalue[1] : svalue);
    }
    String.prototype.startWith=function(str){
        var reg=new RegExp("^"+str);
        return reg.test(this);
    }

    String.prototype.endWith=function(str){
        var reg=new RegExp(str+"$");
        return reg.test(this);
    }
//   alert( Request.QueryString("value"));
</script>

</head>
<body>

<section id="sec1" style="display: none">
    <ul class="list border-b" style="background-color: transparent;">
        <li class="border-t">
            <div class="avatar">
                <span style="background-image:url(logo2.png)"></span>
            </div>
            <div class="list-info">
                <h3 class="nowrap">欢迎使用招商证券服务号</h3>
                <p class="nowrap">微信号：cmschina600999</p>
            </div>
        </li>
    </ul>
    <ul class="list border-b">
        <li class="border-t">
            <div>
                <h4 class="txt-default whitespace" style="padding-top: 1rem">功能介绍</h4>
            </div>
            <div class="list-info">
                <h4 class="txt-info">为您提供招商证券独有的股票行情、开户指引、业务介绍、产品介绍、营业部查询、交易软件下载、证券研究报告摘要和客户专享杂志文摘等综合金融证券微服务。</h4>
            </div>
        </li>
    </ul>
    <h3 class="txt-center" style="margin-top: 2rem">请打开微信“扫一扫”即可关注</h3>
</section>
<section  id="sec2" style="display: none">
    <ul class="list border-b" style="background-color: transparent;">
        <li class="border-t">
            <div class="avatar">
                <span style="background-image:url(logo1.png)"></span>
            </div>
            <div class="list-info">
                <h3 class="nowrap">招商证券企业号</h3>
            </div>
        </li>
    </ul>
    <ul class="list border-b">
        <li class="border-t">
            <div>
                <h4 class="txt-default whitespace" style="padding-top: 1rem">功能介绍</h4>
            </div>
            <div class="list-info">
                <h4 class="txt-info">招商证券股份有限公司官方企业号：知所想，为您赢！</h4>
            </div>
        </li>
    </ul>
    <h3 class="txt-center" style="margin-top: 2rem">请打开微信“扫一扫”即可关注</h3>
</section>

<section  id="sec3" style="display: none" >
    <h3 class="txt-center" style="margin-top: 2rem">您正在访问非招商证券提供的内容：</h3>

    <h5 id="sec3_result" class="txt-info" style="padding:1rem;margin:1rem;border:#cccccc solid 1px;word-wrap: break-word;">http://mp.weixin.qq.com/s?__biz=MjM5MjcwMTkwMA==&tempkey=iLs0mkDlOT1cS5iEZo1Fz33AAuxvnZm14KeUwpr6KtXOH69dmfD2illahGM0jjI7qle69QScoHNYqFau%2BFQPDhHDMVDG8KCqoa6NeL0Z2pDhcD3K48g3o2VDKoN0Gqg8ZofI7xHySP2TlKNt747egw%3D%3D&scene=1&srcid=0809wQ01d0mcErIeizsPYjB4#wechat_redirect</h5>

    <div class="btn-wrap">
        <button class="btn-lg btn-primary" onclick="zs.close();">
            返回
        </button>
    </div>
    <div id="btn_go" class="btn-wrap" style="display: none;">
        <button class="btn-lg btn-danger" onclick="openInBrowser(document.getElementById('sec3_result').innerText)">
            继续访问
        </button>
    </div>
    <h3 id="btn_more" class="txt-center" style="margin-top: 2rem" onclick="document.getElementById('btn_go').style.display='block';document.getElementById('btn_more').style.display='none';" >更多</h3>
</section>
<section  id="sec4" style="display: none">
    <h3 class="txt-center" style="margin-top: 2rem">您正在访问非招商证券提供的内容：</h3>

    <h5 id="sec4_result" class="txt-info" style="padding:1rem;margin:1rem;border:#cccccc solid 1px;word-wrap: break-word;">kj lk l </h5>


</section>
<script type="text/javascript">
  function init() {
      var mUrlPattern = "^https?://([a-zA-Z0-9_])+\\.(newone\\.com\\.cn|cmschina\\.com).*";
      var reg=new RegExp(mUrlPattern);
      var param = Request.QueryString("p");
      var wecharno;
      if(param=="null" || param==null || param==undefined){
          zs.close();
          return;
      }
      if (param.startWith("http://") || param.startWith("https://")) {
           if (param.startWith("http://ydkh.newone.com.cn") || param.startWith("https://ydkh.newone.com.cn")) {
              wecharno = getItemFromUrl(param, "wecharno");
              if (wecharno == null || wecharno == undefined || wecharno.length == 0) {
                  alert("二维码无效，请重试，错误码[50001]！");
                  return;
              }
              openPhone(wecharno);
          } else if (param.startWith("http://qr.weibo.cn/g/3631q4")) { //微博
              navigateTo(param);
          }else if(param.startWith("http://weixin.qq.com/r/akN7Y4DEkN3vrcQA9xZ4")){ //企业号判断
              showSec2();
          }
          else if (param.startWith("http://weixin.qq.com/r/8nWMlF7EPgNBrRr39yDg")) {
              showSec1();
          }else if(reg.test(param)){
              navigateTo(param);
          }else{
              showSec3(param);
          }
      } else { //文本
          showText(param);
      }
  }
    function showText(str){
        document.getElementById("sec4").style.display="block";
        document.getElementById("sec4_result").innerText=str;
    }
    function showSec3(str){
        document.getElementById("sec3").style.display="block";
        document.getElementById("sec3_result").innerText=str;
    }
    function showSec2(){
        document.getElementById("sec2").style.display="block";
    }
    function showSec1(){
        document.getElementById("sec1").style.display="block";
    }
    function openPhone(wecharno){
        zs.open({
            "target": "open_phone",
            "param": {"wecharno": wecharno}
        });
        zs.close();
    }
  function navigateTo(url){
      var oldUrl=location.href;
//     var str="window.location.href=\""+url+"\"; window.location.replace(oldUrl);";
      var str="window.location.replace(\""+url+"\");"
      setTimeout(str,50);
  }
    function openInBrowser(url) {
        zs.open({
            "target": "browser",
            "param": {"url": url}
        });
        setTimeout("zs.close();",300);
    }
    init();
//  history.replaceState && history.replaceState({_index: this._index}, '', location.href);
</script>
</body>
</html>
